<script>
	import store from "./store"
	export default {
		onLaunch: function() {
			// console.log('App Launch')
		},
		onShow: function() {
			const token = store.dispatch('user/getInfo')
			token.then(res => {
				const {username,class_name,major_name,id_card,key} = res.userInfo
				store.commit('user/SET_NAME', username)
				store.commit('user/SET_ID', key)
				store.commit('user/SET_CLASS', class_name)
				store.commit('user/SET_ID_CARD', id_card)
				store.commit('user/SET_MAJOR', major_name)
				store.commit('user/SET_TOKEN', res.token)
			}).catch(err => {
				uni.reLaunch({
					url: '/pages/login/index'
				})
				this.$toast('用户未登录或登陆过期');
			})
		},
		onHide: function() {
			// console.log('App Hide')
		},
		onPageNotFound: function() {
			uni.reLaunch({
				url: '/pages/home/index'
			})
		}
	}
</script>

<style>
	/*每个页面公共css */
	@import 'vant/lib/index.css';

	* {
		list-style: none;
		text-decoration: none;
	}

	page {
		background-color: #F2F6FC;
	}

	.uni-tabbar__item:active {
		background-color: #dedede;
	}
</style>
